﻿namespace Reckoning
{
    /// <summary>
    /// Represents a stop word.
    /// Light string wrapper for use in datagrid binding.
    /// </summary>
    public class StopWordInfo: NotifyPropertyChangedBase
    {
        #region Properties
        private string _word;
        public string Word 
        {
            get
            {
                return _word;
            }
            set
            {
                CheckPropertyChanged<string>("Word", ref _word, ref value);
            }
        }

        public StopWordInfo()
        {
            _word = string.Empty;
        }

        public StopWordInfo(string word)
        {
            _word = word;
        }
        #endregion

        #region Methods
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            else if (obj.GetType() == typeof(string))            
                return _word == (string) obj;            
            else if (obj.GetType() == typeof(StopWordInfo))
            {
                StopWordInfo other = (StopWordInfo) obj;
                return _word.Equals(other._word);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return Word.GetHashCode();
        }
        #endregion
    }
}
